<include file="header"/>
<body>
    <div class="wraper wraper-btm">
        <div class="lists">
            <div class="clearfix">
                <div class="img-box pull-left"><img src="{BEESCRM:$data.huser_image_url}"/></div>
                <div class="info pull-left">
                    <p><span class="name">{BEESCRM:$data.huser_name}</span>
                        <if condition="$data.huser_sex eq 1">男
                            <else if condition="$data.huser_sex eq 2"/>女
                        </if>
                        {BEESCRM:$data.huser_age}岁 {BEESCRM:$data.huser_home_ownership} ￥{BEESCRM:$data.huser_wages}元/天</p>
                        <p>
                            <span class="iconfont icon-weibiaoti1 star"></span>
                            <span class="iconfont icon-weibiaoti1 star"></span>
                            <span class="iconfont icon-weibiaoti1 star"></span>
                            <span class="iconfont icon-weibiaoti1"></span>
                            <span class="iconfont icon-weibiaoti1"></span>
                            {BEESCRM:$data.huser_work_experience}年经验</p>
                            <p>浙二医院</p>
                        </div>
                    </div>
                    <div class="label-box block-top">
                        <span class="label">
                            <if condition="$data.huser_type.type eq 1">全职
                                <else/>兼职
                            </if>
                        </span>
                        <if condition="$tags">
                            <volist name="tags" id="vo">
                                <span class="label label-blue">{BEESCRM:$vo} </span>
                            </volist>
                        </if>
                        <!--<span class="label label-blue">照顾病重患者</span><span class="label label-blue">做饭特别好吃</span><span class="label label-blue">工作细心</span></div>-->


                    </div>
                </div>
                <div class="info-container">
                    <div class="lists text-lists">
                        <p>预约状态：<span class="{BEESCRM:$statusTxet[$data['status']]}">{BEESCRM:$taskStatus[$data['status']]}</span></p>
                        <p>预约时间：{BEESCRM:$data.create_time|date="Y.m.d H:i",###}</p>
                        <p>陪护开始时间：{BEESCRM:$data.start_time|date="Y.m.d",###}</p>
                        <p>陪护结束时间：{BEESCRM:$data.end_time|date="Y.m.d",###}</p>
                        <p>病人情况 ：{BEESCRM:$data.summary}</p>
                        <p>联系人 ：{BEESCRM:$data.real_name}</p>
                        <p>联系电话：{BEESCRM:$data.tel}</p>
                        <if condition="$data.status eq 2">
                            <p>评价：
                                <span class="iconfont icon-weibiaoti1 text-24"></span>
                                <span class="iconfont icon-weibiaoti1 text-24"></span>
                                <span class="iconfont icon-weibiaoti1 text-24"></span>
                                <span class="iconfont icon-weibiaoti1 text-24"></span>
                                <span class="iconfont icon-weibiaoti1 text-24"></span>
                            </p>
                            <input type="hidden" value="" id="score" />
                            <textarea placeholder="亲，给个评价吧~" id="content"></textarea>
                        </if>
                        </div>
                        <div class="lists text-lists">
                        </div>
                    </div>
                    <if condition="$data.status eq 0">
                        <div class="bottom-fixed">
                            <a href="/Park/huser/appointList" class="btn half-btn">返回预约记录</a>
                            <a href="#" class="btn half-btn blue-btn" id="cancelReservation">取消预约</a>
                        </div>
                    <elseif condition="$data.status eq 1" />
                        <div class="bottom-fixed">
                            <a href="/Park/huser/appointList" class="btn half-btn">返回预约记录</a>
                            <a href="#" class="btn half-btn blue-btn" id="endEscort">提前结束陪护</a>
                        </div>
                    <elseif condition="$data.status eq 2" />
                        <a href="#" class="normal-btn" id="goSubmit">确认提交</a>
                    <elseif condition="$data.status eq 3" />
                        <!--<p>评价: {BEESCRM:$evaluate.content}</p>-->
                        <div class="bottom-fixed">
                            <a href="/Park/huser/appointList" class="normal-btn">返回预约记录</a>
                        </div>
                    <elseif condition="$data.status eq 4" />
                        <div class="bottom-fixed">
                            <a href="/Park/huser/appointList" class="normal-btn">返回预约记录</a>
                        </div>
                    </if>
    <!--<div class="fixed-btn">
        <a href="#" class="btn iconfont icon-fanhui01"></a>
        <a href="#" class="btn iconfont icon-zhiding" id="backtotop"></a>
    </div>
    <a href="#" class="normal-btn">确认提交</a>
    <div class="bottom-fixed">
        <a href="#" class="btn half-btn">返回预约记录</a>
        <a href="#" class="btn half-btn blue-btn">取消预约</a>
    </div>
    <div class="bottom-fixed">
        <a href="#" class="btn">返回预约记录</a>
    </div>-->
</div>
<div class="pop-box" id="isEndEscort">
    <div class="main">
        <p class="iconfont icon-shenheshibai"></p>
        <div class="main-text">
            <p class="stress text-center">您确定要提前结束陪护吗？</p>
            <div class="btn-box clearfix">
                <a href="#" class="text-btn" id="cancel">取消</a>
                <a href="#" class="text-btn" id="confirm">确定</a>
            </div>
        </div>
    </div>
</div>

<div class="pop-box" id="getEndEscort">
    <div class="main">
        <p class="iconfont icon-shenheshibai"></p>
        <div class="main-text">
            <p class="stress text-center">您确定要提前结束陪护吗？</p>
            <div class="btn-box clearfix">
                <a href="#" class="text-btn" id="isCancel">取消</a>
                <a href="#" class="text-btn" id="isConfirm">确定</a>
            </div>
        </div>
    </div>
</div>

<div class="pop-box" id="announcements">
    <div class="main">
        <p class="iconfont icon-shenheshibai"></p>
        <div class="main-text">
            <p class="stress text-center">数据异常</p>
            <div class="btn-box clearfix">
            </div>
        </div>
    </div>
</div>
<!--<div class="pop-box">
    <div class="main">
        <p class="iconfont icon-chenggong"></p>
        <div class="main-text">
            <p class="stress text-center">取消成功</p>
            <p class="text-center">您已成功取消本次陪护服务，于2016-2-28开始生效</p>
        </div>
    </div>
</div>-->
</div>
<input type="hidden" value="{BEESCRM:$data.id}" id="recordId">
<input type="hidden" value="{BEESCRM:$data.huser_id}" id="recordHuserId">
<input type="hidden" value="{BEESCRM:$data.real_name}" id="recordRealName">
</body>
<script src="/assets/park/huser/js/jquery-2.1.0.min.js"></script>
<script>

    $('.text-24').each(function(i){
        $(this).click(function(){
            $('.text-24').removeClass('star');
            for(var j = 0 ; j < i+1 ; j++){
                $('.text-24:eq('+j+')').addClass('star');
            }
            $('#score').val(i+1);
        });
    });

    $("#cancelReservation").on('click',function(){
        $("#isEndEscort").show();
    });
    $("#isCancel").on('click',function(){
        $("#getEndEscort").hide();
    });

    $("#cancel").on('click',function(){
        $("#isEndEscort").hide();
    });
    $(function(){
        $("#isEndEscort").hide();
        $("#announcements").hide();
        var height = $(window).height();
        var copyright = $('.copyright').outerHeight();
        $('.wraper').css("minHeight",height);
        $('.wraper').css("paddingBottom",copyright);

        $(function () {
            //当点击跳转链接后，回到页面顶部位置
            $("#backtotop").click(function(){
                $('body,html').animate({scrollTop:0},300);
                return false;
            });
        });
    })
    $("#endEscort").on('click',function(){
        $("#getEndEscort").show();
    });
    $("#confirm").on('click',function(){
       var recordId = $("#recordId").val();
       $.ajax({
           url:'/Park/huser/modifyRecord',
           type:'POST',
           dataType:'json',
           data:{recordId:recordId},
           success:function(data){
               if(data.err_code == 200){
                   $("#announcements").find('.text-center').text(data.message);
                   $("#isEndEscort").hide();
                   $("#announcements").show();
                   reload();
               }}
           });
   });

    $("#isConfirm").on('click',function(){

        var recordId = $("#recordId").val();
        $.ajax({
            url:'/Park/huser/setRecord',
            type:'POST',
            dataType:'json',
            data:{recordId:recordId},
            success:function(data){
                if(data.err_code == 200){
                    $("#announcements").find('.text-center').text(data.message);
                    $("#getEndEscort").hide();
                    $("#announcements").show();
                    reload();
                }}
            });

    });
    //评价
    $("#goSubmit").on('click',function(){
        var recordId = $("#recordId").val();
        var recordHuserId = $("#recordHuserId").val();
        var recordRealName = $("#recordRealName").val();
        var content = $("#content").val();
        var score = $('#score').val();
        $.ajax({
            url:'/Park/huser/setevaluate',
            type:'POST',
            dataType:'json',
            data:{recordId:recordId,recordRealName:recordRealName,recordHuserId:recordHuserId,content:content,score:score},
            success:function(data){
                if(data.err_code == 200){
                    $("#announcements").find('.text-center').text(data.message);
                    $("#announcements").show();
                    reload();
                }}
            });
    });

    //页面刷新
    function reload(){
        setTimeout('location.reload()',2000);
    }
</script>
</html>
